<script>
import { mapState } from 'vuex'
import SearchManage from '@/components/basic/SearchManage.vue'

import { formConfig, column, config } from './formConfig.js'
import { requestApi } from '@/requset/api'
export default {
    extends: SearchManage,
    data() {
        return {
            table_title: '新算法模型',
            isShow: true,
            troubleList: [],
            url: 'algorithm_model',
            formConfig: null,
            tableColumn: null,
            tableData: [],
            baseForm: { is_enable: 1 },
            queryForm: {
                scope_id: null,
                scope_id_list: [],
                m_desc: '',
                page: 1,
                size: 20,
            },
            queryFormC: {
                scope_id: null,
                scope_id_list: [],
                m_desc: '',
                page: 1,
                size: 20,
            },
            actions: [],
            rowKey: 'm_m_code',
        }
    },
    methods: {
        getlist() {
            this.loading = true
            requestApi('post', this.url + `/getlist`, this.queryForm)
                .then((res) => {
                    this.tableData = res.data.data.map((item) => {
                        item.m_config = JSON.parse(item.m_config)
                        return item
                    })
                    this.pagination = res.data.pagination
                    if (res.data.stat) {
                        this.stat = res.data.stat
                    }
                })
                .finally(() => {
                    this.loading = false
                })
        },
    },

    computed: {
        ...mapState('backstage', ['backstageData', 'sensorType', 'algorithmData']),
        tags() {
            return [{ title: '总数', num: this.pagination.total }]
        },
    },
    created() {
        this.formConfig = formConfig
        this.dialog.config = config
        this.tableColumn = column
        this.searchBtn()
    },
}
</script>
<style>
.el-row {
    margin-bottom: 20px;

    &:last-child {
        margin-bottom: 0;
    }
}
</style>
